var o, e = require, t = module, n = exports, i = this && this.__extends || (o = function(e, t) {
    return (o = Object.setPrototypeOf || {
        __proto__: []
    } instanceof Array && function(e, t) {
        e.__proto__ = t;
    } || function(e, t) {
        for (var o in t) t.hasOwnProperty(o) && (e[o] = t[o]);
    })(e, t);
}, function(e, t) {
    function r() {
        this.constructor = e;
    }
    o(e, t), e.prototype = null === t ? Object.create(t) : (r.prototype = t.prototype, 
    new r());
}), a = this && this.__decorate || function(e, t, o, r) {
    var n, i = arguments.length, a = i < 3 ? t : null === r ? r = Object.getOwnPropertyDescriptor(t, o) : r;
    if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) a = Reflect.decorate(e, t, o, r); else for (var p = e.length - 1; 0 <= p; p--) (n = e[p]) && (a = (i < 3 ? n(a) : 3 < i ? n(t, o, a) : n(t, o)) || a);
    return 3 < i && a && Object.defineProperty(t, o, a), a;
};

Object.defineProperty(n, "__esModule", {
    value: !0
});

var r = e("GameManager"), s = e("LoadManager"), c = e("PlayerModel"), l = cc._decorator, d = l.ccclass, u = (l.property, 
function(t) {
    function e() {
        var e = null !== t && t.apply(this, arguments) || this;
        return e.scale = 5 / 64, e.map = new Map(), e;
    }
    return i(e, t), e.prototype.start = function() {}, e.prototype.init = function(e) {
        this.scale = 200 / e;
    }, e.prototype.refresh = function(e) {
        var t = this;
        e.forEach(function(e) {
            return t.refreshNode(e);
        });
    }, e.prototype.refreshNode = function(e) {
        var t, o, n = this;
        this.map.has(e.model.openid) ? e.model.isDead() ? (r.default.getInstance().gameView.removeSprite(this.map.get(e.model.openid)), 
        this.map.delete(e.model.openid)) : this.updateNode(e, this.map.get(e.model.openid)) : e.model.isDead() || (t = r.default.getInstance().gameView, 
        (o = t.getSprite().getComponent(cc.Sprite)) && (o.node.parent = this.node, this.map.set(e.model.openid, o.node), 
        this.updateNode(e, o.node), s.default.getInstance().loadSpriteFrame({
            url: e.model.group == t.curPlayer.model.group ? e.model.openid == t.curPlayer.model.openid ? "texture/battle/my_point" : "texture/battle/blue_point" : "texture/battle/red_point",
            sprite: o,
            success: function() {
                n.node || (t.removeSprite(o.node), n.map.delete(e.model.openid));
            },
            fail: function() {
                t.removeSprite(o.node), n.map.delete(e.model.openid);
            }
        })));
    }, e.prototype.updateNode = function(e, t) {
        var o = e.getDir();
        t.angle = 90 + cc.misc.radiansToDegrees(Math.atan2(o.y, o.x)), t.setPosition(e.node.position.mul(this.scale)), 
        e.model.group != r.default.getInstance().gameView.curPlayer.model.group && (e.model.hasBuffer(c.BufferType.隐藏中) ? t.opacity = 0 : t.opacity = 255);
    }, a([ d ], e);
}(cc.Component));

n.default = u;